package com.lj.mcore.tools;

import com.lj.mcore.entity.Area;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AreaTools {

    public static List ergodicChildren(List<Area> areas){
        List list = new ArrayList();
        for (Area area:areas){
            Map map = new HashMap();
            map.put("aid",area.getId());
            map.put("areaName",area.getAreaName());
            if (area.getChilds().size()>0){
                map.put("children",ergodicChildren(area.getChilds()));
            }
            list.add(map);
        }
        return list;
    }
}
